Skip to content

Fix: resize GuestOS disk #3437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025
Merged

Conversation

songponssw
Copy link
Contributor

Try to fix: #1448

How Lima edit disk

  • The limactl edit updates the disk value to the store. It does not resize disk image. Users have to manually resize by qemu-img
  • Does not support --shrink (fails to start instance)

What I did

  • create a limactl disk add command to add an existing qcow2 disk to Lima.
  • To update GuestOS disk, before start instance, It adds a diffdisk of the instance to Lima, resize, and delete.

@songponssw songponssw marked this pull request as ready for review April 17, 2025 05:34
@songponssw songponssw marked this pull request as draft April 17, 2025 05:34
@songponssw songponssw force-pushed the feat-edit-disk branch 2 times, most recently from b3f95e5 to a0800cf Compare April 17, 2025 09:18
@songponssw songponssw closed this Apr 25, 2025
@songponssw songponssw reopened this Apr 25, 2025
@songponssw
Copy link
Contributor Author

This implementation works fine for increasing the disk size.
However, it returns an error when shrinking, as disk shrinking is not supported.

@AkihiroSuda
Copy link
Member

Needs rebase

@songponssw
Copy link
Contributor Author

Summary of Latest Review:

  1. DiskDir is dedicated to additional disks.
    • I've updated the implementation by creating a new ResizeDiffDisk function, which directly resizes the diffdisk.
  2. Calling inst.inspect() twice:
    • The editAction function returns instance.Start which doesn’t update the validated configuration in the store or the instance yet.
    • The second call to inst.inspect() is to apply the new configuration.
    • The first call to inst.inspect() checks whether the instance exists and is running.

@jandubois
Copy link
Member

Note that #3513 moved the qemu-img functions to pkg/qemu/imgutil.

@songponssw songponssw marked this pull request as ready for review May 10, 2025 14:31
@songponssw songponssw marked this pull request as draft May 11, 2025 14:34
@songponssw songponssw force-pushed the feat-edit-disk branch 5 times, most recently from 4402453 to 855390f Compare May 11, 2025 16:41
@songponssw
Copy link
Contributor Author

I pushed the same code as before cleaning up the commits, but the test workflow is still failing.

@songponssw songponssw marked this pull request as ready for review May 11, 2025 17:31
@AkihiroSuda AkihiroSuda added this to the v1.1.0 milestone May 11, 2025
AkihiroSuda
AkihiroSuda previously approved these changes May 11, 2025
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Signed-off-by: Songpon Srisawai <songpon.ssw@gmail.com>
@songponssw
Copy link
Contributor Author

Thanks a lot for reviewing!

@AkihiroSuda AkihiroSuda merged commit 1ad4cc8 into lima-vm:master May 12, 2025
34 checks passed
@songponssw songponssw deleted the feat-edit-disk branch May 12, 2025 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Changing the disk size in lima.yaml should resize the disk
3 participants